package java8.lambda;

import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

public class Lambda {
    public static void main(String[] args) {
        List<String> names1 = Arrays.asList("peter", "anna", "mike", "xenia");
        List<String> names2 = Arrays.asList("peter", "anna", "mike", "xenia");
        List<String> names3 = Arrays.asList("peter", "anna", "mike", "xenia");
        List<String> names4 = Arrays.asList("peter", "anna", "mike", "xenia");

        Collections.sort(names1, new Comparator<String>() {
            @Override
            public int compare(String o1, String o2) {
                return o1.compareTo(o2);
            }
        });

        //java8
        Collections.sort(names2, ((o1, o2) -> o1.compareTo(o2)));

        Collections.sort(names3, (String::compareTo));

        names4.sort((String::compareTo));
    }
}
